﻿using ReflectionStudio.Core.Events;
using System;
using System.ComponentModel;
using System.Data;
using System.Windows;
namespace WPFExcelReport
{
    public partial class TNOVAK:UIVAK
    { 
        public TNOVAK()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VVAKOLL();
            this.DataContext = MV; 
            InitializeComponent(); 
        }
        public override void vwMaster_CurrentChanged(object sender, EventArgs e)
        {
            base.vwMaster_CurrentChanged(sender, e);
            dwVAK = dwMaster;
            if (dwMaster == null)
            {
                KEY = "";
            }
            else
            {

                KEY = dwMaster["VAKKOLL"].ToString();
            }
        }
        public override void LOADBYAUF()
        { 
            base.LOADBYAUF();
            if (!IsNew)
                return;
            if (ORDERNUM.Length < 5)
                return; 
            dwData = TBMain.NewRow();
            dwData["VAKMANDANT"] = app.Mandant;
            dwData["VAKKOLL"]= ORDERNUM.Substring(0,5);
            SResult = ((VVAKOLL)MV).QueryVAKOLL(dwData, 2);
            MergeData(SResult,true);           
        }
    }
}
